package database;

import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;

import object.Level;
import utility.StringUtil;
import clientMain.Login;

public class LevelDelegate {
	public Vector<Level> getListLvl(){
		Vector<Level> list = new Vector<Level>();
		try {
			Login.conn.setAutoCommit(false);
			CallableStatement cst = Login.conn.prepareCall("{call sp_ListLvl}");
			ResultSet rs = cst.executeQuery();
			while(rs.next()){
				Level lvl = new Level();
				lvl.setLvlValue(rs.getInt("Lvl_Value"));
				lvl.setLvlDescribe(StringUtil.getFilterIllegal(rs.getString("Lvl_Describe")));
				list.add(lvl);
			}
			Login.conn.commit();
		} catch (SQLException e) {
			e.printStackTrace();
			list = null;
		}
		return list;
	}
}
